package a.f.a;

import a.c.bb;
import a.c.x;
import a.c.y;
import a.c.z;
import a.f.o;
import a.f.rc;

import java.util.Comparator;

class j
  implements rc
{
  private x e;
  private a.d.w f = new a.d.w();
  boolean g = true;
  boolean h = false;
  double i = 0.0D;
  private double j;
  private bb k;
  double l;
  
  public a.d.w a()
  {
    return this.f;
  }
  
  public void a(a.d.w paramw)
  {
    this.f = paramw;
  }
  
  boolean b()
  {
    return this.g;
  }
  
  void a(boolean paramBoolean)
  {
    this.g = paramBoolean;
  }
  
  public double c()
  {
    return this.i;
  }
  
  public void a(double paramDouble)
  {
    this.i = paramDouble;
  }
  
  void b(double paramDouble)
  {
    this.j = paramDouble;
  }
  
  public bb d()
  {
    return this.k;
  }
  
  private z a(o paramo, double paramDouble1, double paramDouble2, double paramDouble3)
  {
    int i1 = e.M;
    boolean bool = e.L;
    z localz = new z();
    localz.add(a(paramDouble2, paramDouble3, paramDouble1, 0, 0));
    a.c.e[] arrayOfe = paramo.t();
    int m = 1;
    label119:
    label121:
    do
    {
      if (m >= 2 * arrayOfe.length) {
        break;
      }
      int n = 1;
      do
      {
        do
        {
          if (n >= 2 * m) {
            break;
          }
          a.d.w localw = a(paramDouble2, paramDouble3, paramDouble1, n, m);
          localz.add(localw);
          n += 2;
          if (i1 != 0) {
            break label121;
          }
          if (bool) {
            break label119;
          }
        } while (!bool);
      } while (i1 != 0);
      m <<= 1;
    } while (!bool);
    return localz;
  }
  
  private double a(double paramDouble1, double paramDouble2, double paramDouble3, double paramDouble4, double paramDouble5, double paramDouble6)
  {
    double d1 = paramDouble3 - paramDouble1;
    double d2 = paramDouble4 - paramDouble2;
    double d3 = paramDouble5 - paramDouble1;
    double d4 = paramDouble6 - paramDouble2;
    double d5 = d1 * d3 + d2 * d4;
    double d6 = Math.sqrt(d1 * d1 + d2 * d2) * Math.sqrt(d3 * d3 + d4 * d4);
    if (e.M == 0) {}
    double d7 = d6 == 0.0D ? 0.0D : Math.acos(d5 / d6);
    return d7;
  }
  
  private a.c.e a(a.d.w paramw, o paramo, a.c.e[] paramArrayOfe, x paramx, double paramDouble1, double paramDouble2)
  {
    int n = e.M;
    boolean bool = e.L;
    Object localObject = null;
    double d1 = 1.7976931348623157E+308D;
    double d2 = 1.7976931348623157E+308D;
    int m = 0;
    do
    {
      if (m >= paramArrayOfe.length) {
        break;
      }
      if (bool) {
        break label133;
      }
      a.c.e locale = paramArrayOfe[m];
      double d3 = paramo.m(locale);
      double d4 = paramo.n(locale);
      double d5 = a(paramw.a, paramw.b, d3, d4, paramDouble1, paramDouble2);
      double d6 = a(paramw.a, paramw.b, d3, d4, d5);
      if (n == 0)
      {
        if (d6 < d1)
        {
          d1 = d6;
          localObject = locale;
        }
        m++;
      }
    } while (!bool);
    label133:
    return localObject;
  }
  
  private double a(o paramo, a.c.e parame, a.d.w paramw)
  {
    return paramw.a(paramo.m(parame), paramo.n(parame));
  }
  
  double a(double paramDouble1, double paramDouble2, double paramDouble3, double paramDouble4, double paramDouble5)
  {
    double d = a.d.w.a(paramDouble1, paramDouble2, paramDouble3, paramDouble4);
    if (e.M == 0) {
      if (d == 0.0D) {
        return d;
      }
    }
    return d * (1.0D + Math.pow(4.0D * paramDouble5 / 3.141592653589793D, 8.0D));
  }
  
  private a.d.w a(double paramDouble1, double paramDouble2, double paramDouble3, int paramInt1, int paramInt2)
  {
    double d1 = paramInt1 == 0 ? 0.0D : 3.141592653589793D * paramInt1 / paramInt2;
    double d2 = Math.cos(d1);
    double d3 = Math.sin(d1);
    return new a.d.w(paramDouble1 + d2 * paramDouble3, paramDouble2 + d3 * paramDouble3);
  }
  
  public boolean canLayout(o paramo)
  {
    return true;
  }
  
  public double e()
  {
    return this.l;
  }
  
  public boolean f()
  {
    return this.h;
  }
  
  public void b(boolean paramBoolean)
  {
    this.h = paramBoolean;
  }
  
  public void doLayout(o paramo)
  {
    int n = e.M;
    boolean bool = e.L;
    double d1 = this.f.a();
    double d2 = this.f.b();
    if (n == 0) {
      if (this.g)
      {
        if (n != 0) {
          break label70;
        }
        this.l = a(paramo, d1, d2);
        if (!bool) {
          break label69;
        }
      }
    }
    this.l = this.j;
    label69:
    label70:
    z localz = a(paramo, this.l + this.i, d1, d2);
    x localx1 = paramo.B();
    x localx2 = paramo.B();
    a.c.e[] arrayOfe = paramo.t();
    int m = 0;
    this.k = new bb();
    Object localObject1 = localz.h();
    if (((y)localObject1).e())
    {
      if ((n == 0) && (bool)) {
        break label292;
      }
      if (m > arrayOfe.length) {}
    }
    Object localObject2;
    Object localObject3;
    label280:
    while (n != 0)
    {
      localObject2 = (a.d.w)((y)localObject1).j();
      localObject3 = a((a.d.w)localObject2, paramo, arrayOfe, localx1, d1, d2);
      if (n == 0)
      {
        if (localObject3 != null)
        {
          if (n != 0) {
            break label280;
          }
          if (!localx1.getBool(localObject3))
          {
            localx2.a(localObject3, localObject2);
            this.k.add(localObject3);
            if (n == 0)
            {
              if (this.e != null) {
                this.e.a(localObject3, true);
              }
              m++;
            }
            localx1.a(localObject3, true);
          }
        }
        ((y)localObject1).f();
      }
      if (!bool) {
        break;
      }
    }
    if (!this.h)
    {
      label292:
      localObject1 = paramo.v();
      do
      {
        if (!((a.c.w)localObject1).e()) {
          break;
        }
        localObject2 = ((a.c.w)localObject1).d();
        localObject3 = (a.d.w)localx2.get(localObject2);
        if (bool) {
          break label386;
        }
        if (localObject3 != null) {
          paramo.a((a.c.e)localObject2, (a.d.w)localObject3);
        }
        ((a.c.w)localObject1).f();
      } while (!bool);
      if (n == 0) {
        this.k.a(new Comparator()
        {
          private final x val$newPos;
          
          public int compare(Object paramAnonymousObject1, Object paramAnonymousObject2)
          {
            int i = e.M;
            a.d.w localw1 = (a.d.w)this.val$newPos.get(paramAnonymousObject1);
            a.d.w localw2 = (a.d.w)this.val$newPos.get(paramAnonymousObject2);
            double d1 = Math.atan2(localw1.b, localw1.a);
            double d2 = Math.atan2(localw2.b, localw2.a);
            if (i == 0) {}
            if (i == 0) {}
            return d1 < d2 ? -1 : d1 > d2 ? 1 : 0;
          }
        });
      }
      label386:
      localObject1 = new e();
      ((e)localObject1).i(false);
      ((e)localObject1).c(this.l);
      localObject2 = this.k.m();
      double d3 = Math.atan2(paramo.q((a.c.e)localObject2), paramo.p((a.c.e)localObject2));
      ((e)localObject1).a(d3);
      ((e)localObject1).c(this.k.l(), d3);
    }
    paramo.a(localx2);
    paramo.a(localx1);
  }
  
  private double a(o paramo)
  {
    int i1 = e.M;
    boolean bool = e.L;
    double d = 0.0D;
    a.c.e[] arrayOfe = paramo.t();
    int m = 0;
    label105:
    label107:
    do
    {
      if (m >= arrayOfe.length) {
        break;
      }
      a.c.e locale1 = arrayOfe[m];
      a.d.w localw = paramo.o(locale1);
      int n = m + 1;
      do
      {
        if (n >= arrayOfe.length) {
          break;
        }
        a.c.e locale2 = arrayOfe[n];
        d = Math.max(d, a(paramo, locale2, localw));
        n++;
        if (i1 != 0) {
          break label107;
        }
        if (bool) {
          break label105;
        }
      } while (!bool);
      if (i1 == 0) {
        m++;
      }
    } while (!bool);
    return d / 2.0D;
  }
  
  private double a(o paramo, double paramDouble1, double paramDouble2)
  {
    int m = e.M;
    boolean bool = e.L;
    double d = 0.0D;
    a.c.w localw = paramo.v();
    do
    {
      if (!localw.e()) {
        break;
      }
      a.d.w localw1 = paramo.o(localw.d());
      if (m == 0)
      {
        if (bool) {
          break label81;
        }
        d = Math.max(d, localw1.a(paramDouble1, paramDouble2));
        localw.f();
      }
    } while (!bool);
    label81:
    return d;
  }
  
  public void a(x paramx)
  {
    this.e = paramx;
  }
}



/* Location:           E:\idea\

 * Qualified Name:     a.f.a.j

 * JD-Core Version:    0.7.0.1

 */